package gates;

import gene.ChinkleException;

import java.util.Random;

public abstract class Gates{
	public Gates gate;
	static Random random = new Random(System.currentTimeMillis());
	
	//Used to randomly generate a gate
	public static Gates getGate() throws ChinkleException{
		
		
		
		switch(random.nextInt(4)){
		case 0:
			return new Wire();
		case 1:
			return new NandGate();
		case 2:
			return new NorGate();
		case 3:
			return new XorGate();
		default:
			throw new ChinkleException("Invalid gate creation");

		}
	}
	abstract public boolean eval(boolean input1, boolean input2);
	abstract public String toString();
	abstract public String toByte();

}
